import request from '@/utils/axios'
//签名
import _bale from '@/utils/package'
//接口地址
import * as url from '@/utils/apiUrl'
import qs from 'qs'
//参数序列化
import { GetParamString } from '@/utils/mixin'

//member

//app端用户账号密码登录
export function doLogin(params) {
  return request({
    url: '/login/appdoLogin',
    method: 'post',
    data: qs.stringify(_bale('appdoLogin', params))
  })
}
//金桥一卡通
export function jqLogin(params) {
  return request({
    url: url.server_sso + '/wx/jqUserLogin',
    method: 'post',
    data: qs.stringify(_bale('jqUserLogin', params))
  })
}

//验证用户账号是否可用
export function validateAccount(params) {
  return request({
    url: url.server_sso + '/userService/validateAccount',
    method: 'post',
    data:  qs.stringify(_bale('validateAccount', params))
  })
}

 
//用户发送手机验证码
export function sendPhoneCode(params) {
  return request({
    url:  url.server_sso + '/userService/sendPhoneCode',
    method: 'post',
    data:   qs.stringify(_bale('sendPhoneCode', params))
  })
}

 
//验证手机验证码
export function validateCode(params) {
  return request({
    url: url.server_sso + '/userService/validatePhoneCode',
    method: 'post',
    data:  qs.stringify(_bale('validatePhoneCode', params))
  })
}

 
//设置密码
export function registered(params) {
  return request({
    url: url.server_sso + '/userService/app/register',
    method: 'post',
    data:  qs.stringify(_bale('register', params))
  })
}
 
//获取个人信息
export function getUserInfo(params) {
  return request({
    url: url.server_sso + '/userService/app/getUserInfo',
    method: 'post',
    data:  qs.stringify(_bale('getUserInfo', params))
  })
}
 
//获取地址详细信息
export function getAddressList(params) {
  return request({
    url: url.server_shop + '/userAddress/seleteUserAddressList',
    method: 'post',
    data: qs.stringify(_bale('seleteUserAddressList', params))
  })
}
 
//新建地址
export function updateUserAddress(params) {
  return request({
    url: url.server_shop + '/userAddress/addUserAddress',
    method: 'post',
    data: qs.stringify(_bale('addUserAddress', params))
  })
}
 

//新建地址
export function getUserAddress(params) {
  return request({
    url:url.server_shop + '/userAddress/selectUserAddress',
    method: 'post',
    data: qs.stringify(_bale('selectUserAddress', params))
  })
}
 
 
//获取金桥卡号
export function getUserCard(params) {
  return request({
    url:url.server_sso + '/wx/getJqUserCard',
    method: 'post',
    data: qs.stringify(_bale('getJqUserCard', params))
  })
}
 
 
export function sendEPayPhoneCode(params) {
  return request({
    url:url.server_shop + '/wx/sendSms',
    method: 'post',
    data:  qs.stringify(_bale('sendSms', params))
  })
}
//shop

//搜索商品
export function searchGoods(params) {
  return request({
    url:url.server_search + '/jqSearch' + GetParamString(params),
    methods: 'get'
  })
}
 
//获取商品详情
export function getGoodsDetails(params) {
  return request({
    url:url.server_shop + '/mallGoods/getGoodsDetails',
    method: 'post',
    data: qs.stringify(_bale('getGoodsDetails', params))
  })
}
 
//获取尺码信息
export function getSpecInfo(params) {
  return request({
    url:url.server_shop + '/mallGoods/getSupplierInfo',
    method: 'post',
    data: qs.stringify(_bale('getSupplierInfo', params))
  })
}
 
//金桥加入购物车
export function addShopCart(params) {
  return request({
    url:url.server_shop + '/app/index/add_jin_qiao_shop_cart',
    method: 'post',
    data:  qs.stringify(_bale('add_jin_qiao_shop_cart', params))
  })
}
 
// 获取购物车商品列表
export function getCartProductList(params) {
  return request({
    url:url.server_shop + '/mallGoods/getShopCart',
    method: 'post',
    data: qs.stringify(_bale('getShopCart', params))
  })
}
 
// 修改购物车的数量
export function updateProCount(params) {
  return request({
    url:url.server_shop + '/mallGoods/updateShopCart',
    method: 'post',
    data:  qs.stringify(_bale('updateShopCart', params))
  })
}
 

// 删除购物车尺码
export function delCartPro(params) {
  return request({
    url:url.server_shop + '/mallGoods/deleteShopCart',
    method: 'post',
    data: qs.stringify(_bale('deleteShopCart', params))
  })
}
// 删除用户地址
export function delUserAddress(params) {
  return request({
    url: url.server_shop +'/userAddress/deleteUserAddress',
    method: 'post',
    data: qs.stringify(_bale('deleteUserAddress', params))
  })
}
 
// 购物车结算验证商品库存
export function validateCartNum(params) {
  return request({
    url:url.server_shop + '/mallGoods/validateShopCart',
    method: 'post',
    data:qs.stringify(_bale('validateShopCart', params))
  })
}
 
// 设置购物车key
export function submitCartPro(params) {
  return request({
    url:url.server_shop + '/mallGoods/setCartKey',
    method: 'post',
    data:qs.stringify(_bale('setCartKey', params))
  })
}
 

// 确认采购/一件代发 订单
export function getConfirmOrder(params) {
  return request({
    url: url.server_shop + '/mallGoods/confirmOrder',
    method: 'post',
    data:qs.stringify(_bale('confirmOrder', params))
  })
}
 

//获取确认订单商品
export function getConfirmProduct(params) {
  return request({
    url: url.server_shop + '/app/index/confirm_jin_qiao_order',
    method: 'post',
    data:qs.stringify(_bale('confirm_jin_qiao_order', params))
  })
}
 
// 提交确认订单
export function createOrder(params) {
  return request({
    url: url.server_shop + '/app/index/submit_jin_qiao_order',
    method: 'post',
    data:qs.stringify(_bale('submit_jin_qiao_order', params))
  })
}
 
// 支付订单
export function payOrder(params) {
  return request({
    url: url.server_shop + '/order/payOrder',
    method: 'post',
    data:qs.stringify(_bale('payOrder', params))
  })
}
 
 export function ePay(params) {
  return request({
    url: url.server_shop + '/wx/cardConsume',
    method: 'post',
    data:qs.stringify(_bale('cardConsume', params))
  })
}
 
//获取品牌

export function getBrandlList(params) {
  return request({
    url:
      url.server_shop +
      '/index/get_brand_list' +
      GetParamString(_bale('get_brand_list', params)),
    method: 'get'
  })
}
